using System.Collections;
using UnityEngine;

public class Chapter03_06_4_Coroutine : MonoBehaviour
{
    // Start is called before the first frame update
    private void Start()
    {
        StartCoroutine(CallStartCoroutine());
    }

    // Update is called once per frame
    private void Update()
    {

    }

    IEnumerator Call()
    {
        Debug.Log("Call 1");
        yield return new WaitForFixedUpdate();
        Debug.Log("Call 2");
    }

    IEnumerator CallSeconds()
    {
        var wait = new WaitForSeconds(1);
        for (int i = 0; i < 10; i++)
        {
            yield return wait;
            Debug.Log("Call");
        }
    }

    IEnumerator CallStartCoroutine()
    {
        yield return StartCoroutine(Call2());
        Debug.Log("Call");
    }

    IEnumerator Call2()
    {
        for (int i = 0; i < 10; i++)
        {
            yield return null;
            Debug.Log("Call2");
        }
    }
}
